package com.itheima.pool;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
/*
默认线程池(缓冲线程池)
 */
public class Demo01 {

    public static void main(String[] args) {
        Ticket ticket = new Ticket();
        //new Thread(ticket)
        //创建线程池
        ExecutorService pool = Executors.newCachedThreadPool();

        //从线程池中获取线程让线程干活
        //还给线程池
        pool.submit(ticket);
        pool.submit(ticket);
        pool.submit(ticket);



        pool.shutdown();
    }
}
